import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    name: 'login',
    component: () => import('@/views/login')
  },
  {
    path: '/print',
    name: 'print',
    component: () => import('../views/printManage/index.vue')
  },
  {
    path: '/problem',
    name: 'problem',
    meta: {
      title: '问题反馈'
    },
    component: () => import('../views/problem/index.vue'),
    redirect: '/list',
    children: [
      {
        path: '/list',
        name: 'list',
        meta: {
          title: '问题列表'
        },
        component: () => import('../views/problem/list.vue')
      },
      {
        path: '/list/add',
        meta: {
          title: '问题列表 / 新增'
        },
        component: () => import('../views/problem/add.vue')
      },
      {
        path: '/list/details/:id',
        meta: {
          title: '问题列表 / 详情'
        },
        component: () => import('../views/problem/details.vue')
      },
      {
        path: '/hotspot',
        name: 'hotspot',
        meta: {
          title: '热点问题'
        },
        component: () => import('../views/problem/hotspot.vue')
      }
    ]
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  // history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
